<script>
    $(document).ready(function(){
       $("#cboLang").change(function(){
           var str = $(this).val();
           if(str=="jp"){
                var strURL = "<?php echo base_url()."jp"; ?>";
            }
            else{
               var strURL = "<?php echo base_url()."en"; ?>"; 
            }
           $.ajax({
                url: strURL,
                type: 'POST',
                cache: false,
                success: function(string){
                    window.location.href = '<?php echo base_url();?>';
                }
           });
       })               
    });
</script>
<div id="main_content" style="position:relative; width: 1024px; margin: 35px auto;" class="login_app">
    <div id="login">
    <table>
    <form action="<?php echo base_url();?>login" method="post">      
        <tr>
            <td align="right"><label><b><?php echo $this->lang->line('Home_UserName');?></b></label></td>
            <td><input type="text" size="20" name="txtUserName" maxlength="50" value="<?php echo set_value('txtUserName'); ?>" /> </td>
        </tr>     
        <tr>
            <td align="right"><label><b><?php echo $this->lang->line('Home_Password');?></b></label></td>
            <td><input type="password" size="20" name="txtPassword" maxlength="50"/> </td>
        </tr>
        <tr>
            <td align="right"><label><b><?php echo $this->lang->line('Home_CompanyCode');?></b></label></td>
            <td><input type="text" size="10" name="txtCompanyCode" maxlength="50" value="<?php echo set_value('txtCompanyCode'); ?>" /> </td>
        </tr>        
        <tr>
            <td align="right"><label><b><?php echo $this->lang->line('Home_lang');?></b></label></td>
            <td>
                <select name="cboLang" id="cboLang">
                   <?php
                   $lang = $this->config->item('cfLanguage');
                   $langsession = $this->session->userdata('lang');
                   foreach($lang as $key=>$value) {
                       ?>
                        <option value="<?php echo $value; ?>" <?php if($langsession==$value){echo "selected='selected'";}?> ><?php echo $key; ?></option>
                       <?php
                   }
                   ?>
                </select>
            </td>
        </tr>        
        <tr>
            <td align="right">
                <a href="<?php echo base_url();?>reset-pass"><?php echo $this->lang->line('Home_LostPasword'); ?></a>
            </td>
            <td>
                <input type="submit"  name="btnSubmit" value="<?php echo $this->lang->line('Home_Login'); ?>" id="submit" />
            </td>
        </tr>
        <tr>
            <td align="left" colspan="2">
                <span class="error"><?php if(isset($message)) echo $message; ?></span>
                <span class="error"><?php echo form_error('txtUserName'); ?></span>
                <span class="error"><?php echo form_error('txtPassword'); ?></span>
                <span class="error"><?php echo form_error('txtCompanyCode'); ?></span>
            </td>
        </tr>                                         
    </form>
    </table>
    </div>
</div>